list/replace
l search-for replace-withSummary
Return a new list where every occurence of SEARCH-FOR is replaced with REPLACE-WITH
Return value
Uses (equal?) so we can search/replace lists/trees and other complex data structures
Bytecode
Probably only interesting to you if you want to understand more about the Nujel VM or care very much about performance.
( 0 ($get/val 'l)) ( 2 ($jf* 7)) ( 5 ($push/false)) ( 6 ($jmp* 4)) ( 9 ($push/true)) ( 10 ($jf* 7)) ( 13 ($push/nil)) ( 14 ($jmp* 98)) ( 17 ($get/val 'equal?)) ( 19 ($get/val 'l)) ( 21 ($get/val 'search-for)) ( 23 ($apply 2)) ( 25 ($jf* 8)) ( 28 ($get/val 'replace-with)) ( 30 ($jmp* 82)) ( 33 ($get/val 'equal?)) ( 35 ($get/val 'l)) ( 37 ($car)) ( 38 ($get/val 'search-for)) ( 40 ($apply 2)) ( 42 ($jf* 20)) ( 45 ($get/val 'replace-with)) ( 47 ($get/val 'list/replace)) ( 49 ($get/val 'l)) ( 51 ($cdr)) ( 52 ($get/val 'search-for)) ( 54 ($get/val 'replace-with)) ( 56 ($apply 3)) ( 58 ($cons)) ( 59 ($jmp* 53)) ( 62 ($push/true)) ( 63 ($jf* 48)) ( 66 ($push/val :pair)) ( 68 ($get/val 'type-of)) ( 70 ($get/val 'l)) ( 72 ($car)) ( 73 ($apply 1)) ( 75 ($=)) ( 76 ($jf* 17)) ( 79 ($get/val 'list/replace)) ( 81 ($get/val 'l)) ( 83 ($car)) ( 84 ($get/val 'search-for)) ( 86 ($get/val 'replace-with)) ( 88 ($apply 3)) ( 90 ($jmp* 6)) ( 93 ($get/val 'l)) ( 95 ($car)) ( 96 ($get/val 'list/replace)) ( 98 ($get/val 'l)) ( 100 ($cdr)) ( 101 ($get/val 'search-for)) ( 103 ($get/val 'replace-with)) ( 105 ($apply 3)) ( 107 ($cons)) ( 108 ($jmp* 4)) ( 111 ($push/nil)) ( 112 ($ret))