Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 145 additions & 0 deletions site/demo/friendly.cast
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
{"version": 2, "width": 80, "height": 24, "timestamp": 1790251696, "idle_time_limit": 2.0, "env": {"SHELL": "/bin/zsh", "TERM": null}}
[0.322426, "o", "$"]
[0.34183, "o", " "]
[0.368099, "o", "l"]
[0.394322, "o", "e"]
[0.413782, "o", "x"]
[0.43992, "o", "-"]
[0.466835, "o", "c"]
[0.493066, "o", "o"]
[0.515127, "o", "d"]
[0.541436, "o", "e"]
[0.560233, "o", " "]
[0.586488, "o", "-"]
[0.60927, "o", "-"]
[0.632588, "o", "o"]
[0.658847, "o", "l"]
[0.685014, "o", "l"]
[0.710754, "o", "a"]
[0.736864, "o", "m"]
[0.762892, "o", "a"]
[0.78923, "o", " "]
[0.815303, "o", "\""]
[0.841514, "o", "w"]
[0.867624, "o", "r"]
[0.893813, "o", "i"]
[0.919939, "o", "t"]
[0.946044, "o", "e"]
[0.972126, "o", " "]
[0.998407, "o", "a"]
[1.024559, "o", " "]
[1.050523, "o", "f"]
[1.07614, "o", "u"]
[1.102281, "o", "n"]
[1.128362, "o", "c"]
[1.153551, "o", "t"]
[1.179569, "o", "i"]
[1.206008, "o", "o"]
[1.233048, "o", "n"]
[1.256004, "o", " "]
[1.282298, "o", "t"]
[1.308625, "o", "h"]
[1.334741, "o", "a"]
[1.360826, "o", "t"]
[1.385925, "o", " "]
[1.412162, "o", "t"]
[1.438492, "o", "e"]
[1.464667, "o", "l"]
[1.490844, "o", "l"]
[1.517022, "o", "s"]
[1.543123, "o", " "]
[1.568093, "o", "m"]
[1.594111, "o", "e"]
[1.620385, "o", " "]
[1.646594, "o", "i"]
[1.667512, "o", "f"]
[1.694298, "o", " "]
[1.720434, "o", "a"]
[1.741371, "o", " "]
[1.761141, "o", "w"]
[1.787392, "o", "o"]
[1.806137, "o", "r"]
[1.828768, "o", "d"]
[1.847229, "o", " "]
[1.873416, "o", "r"]
[1.89962, "o", "e"]
[1.925884, "o", "a"]
[1.95204, "o", "d"]
[1.978242, "o", "s"]
[2.004496, "o", " "]
[2.029062, "o", "t"]
[2.051352, "o", "h"]
[2.077512, "o", "e"]
[2.103709, "o", " "]
[2.13023, "o", "s"]
[2.152844, "o", "a"]
[2.17898, "o", "m"]
[2.205062, "o", "e"]
[2.229779, "o", " "]
[2.255983, "o", "b"]
[2.282085, "o", "a"]
[2.308055, "o", "c"]
[2.334363, "o", "k"]
[2.360655, "o", "w"]
[2.386979, "o", "a"]
[2.413041, "o", "r"]
[2.439209, "o", "d"]
[2.466072, "o", "s"]
[2.492203, "o", ","]
[2.518418, "o", " "]
[2.537597, "o", "l"]
[2.563765, "o", "i"]
[2.582704, "o", "k"]
[2.608973, "o", "e"]
[2.628666, "o", " "]
[2.64886, "o", "r"]
[2.673128, "o", "a"]
[2.694683, "o", "d"]
[2.716595, "o", "a"]
[2.735386, "o", "r"]
[2.761843, "o", "\""]
[2.78521, "o", "\r\n"]
[30.034329, "o", "The user wants a function that checks if a word is a palindrome. Let me write a Lex function for this. I'll check the string stdlib for reversing or use a simple approach.\r\n\r\n"]
[31.105816, "o", "Let me write a palindrome function. I need to check if a string equals its reverse. Let me look at the str module to find how to reverse a string.\r\n"]
[31.105926, "o", "\r\n[tool: lex_stdlib]\r\n"]
[31.119029, "o", "[running: lex_stdlib]\r\n[ok]\r\n"]
[39.279565, "o", "Let me write an is_palindrome function. I'll split into characters, reverse, and compare. str.join and str.split with empty separator.\r\n"]
[39.279718, "o", "\r\n[tool: write]\r\n"]
[39.467702, "o", "[running: write]\r\n[ok]\r\n"]
[42.186758, "o", "The check passed. Let me run the examples to confirm.\r\n"]
[42.186863, "o", "\r\n[tool: lex_run]\r\n"]
[42.262623, "o", "[running: lex_run]\r\n[ok]\r\n"]
[45.986744, "o", "Let me run a test by passing args.The `lex check` passed and the examples compiled fine. The runtime error is just because I invoked the function without arguments (it needs a word). Let me confirm it runs correctly with a value:\r\n"]
[45.98686, "o", "\r\n[tool: write]\r\n"]
[46.019498, "o", "[running: write]\r\n[error]\r\n"]
[49.901989, "o", "The example test cases already validated the function, so the demo file is just clutter. Let me remove it and rely on the examples to verify everything works.\r\n"]
[49.902106, "o", "\r\n[tool: bash]\r\n"]
[49.915466, "o", "[running: bash]\r\n[ok]\r\n"]
[50.822147, "o", "Let me just verify with a test.\r\n"]
[50.822176, "o", "\r\n[tool: lex_test]\r\n"]
[50.828755, "o", "[running: lex_test]\r\n"]
[50.828815, "o", "[ok]\r\n"]
[52.705213, "o", "The lex_run had an arity issue, probably it just requires args. Let me just run with an argument.\r\n"]
[52.705298, "o", "\r\n[tool: lex_run]\r\n"]
[52.714481, "o", "[running: lex_run]\r\n"]
[52.714505, "o", "[ok]\r\n"]
[53.970674, "o", "It works. The earlier error was because I ran it without an argument.Done. The function `is_palindrome` in `src/palindrome.lex`:\r\n\r\n"]
[54.031453, "o", "```lex\r\n"]
[54.226973, "o", "fn is_palindrome(word :: Str) -> Bool\r\n"]
[54.296715, "o", " examples {\r\n"]
[54.465072, "o", " is_palindrome(\"radar\") => true,\r\n"]
[54.605652, "o", " is_palindrome(\"Racecar\") => true,\r\n"]
[54.746254, "o", " is_palindrome(\"hello\") => false,\r\n"]
[54.983053, "o", " is_palindrome(\"\") => true\r\n"]
[54.983437, "o", " }\r\n"]
[55.054665, "o", "{\r\n"]
[55.19607, "o", " let lower := str.to_lower(word)\r\n"]
[55.410324, "o", " let reversed := str.join(list.reverse(str.split(lower, \"\")), \"\")\r\n"]
[55.480359, "o", " lower == reversed\r\n"]
[55.480631, "o", "}\r\n"]
[55.480867, "o", "```\r\n\r\n"]
[56.600585, "o", "It's a pure function, type-checks clean, and passes its examples (verified `is_palindrome(\"radar\") => true`). It lowercases the word first, so matching is case-insensitive — e.g. `\"Racecar\"` also returns `true`.\r\n\r\n"]
[57.320645, "o", "The earlier `lex run` panic was just because I invoked it without the string argument; passing `\"radar\"` confirms it returns `true`.\r\n"]
[57.320673, "o", "\r\n"]
[57.321753, "o", "\r\n(trail: .lex/sessions/cli-1790251703662-4b7b9990.db)\r\n\r\n"]
[57.321849, "o", "null\r\n"]
Loading
Loading